Skip to content

feat(plugins): Add prompt hook contributions#621

Merged
dcramer merged 6 commits into
mainfrom
feat/plugin-prompt-hooks
Jun 19, 2026
Merged

feat(plugins): Add prompt hook contributions#621
dcramer merged 6 commits into
mainfrom
feat/plugin-prompt-hooks

Conversation

@dcramer

@dcramer dcramer commented Jun 19, 2026

Copy link
Copy Markdown
Member

Runtime plugins can now contribute bounded system and user prompt context through generic prompt hooks instead of memory-specific core APIs. The public plugin API exposes a platform-only system prompt context, request-scoped user prompt context, bounded JSON session appends, and shared validation schemas so plugin authors see the same contract core enforces.

Core renders accepted plugin prompt text inside Junior-owned wrappers and commits matching plugin session appends in the same durable input checkpoint as the model-visible prompt. Initial, follow-up, and steering user prompts run the same userPrompt path; the focused integration test exercises generateAssistantReply with only the Pi/model boundary faked, alongside unit coverage for validation, prompt rendering, and session-log projection behavior.

@vercel

vercel Bot commented Jun 19, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
junior-docs Ready Ready Preview, Comment Jun 19, 2026 4:40pm

Request Review

Comment thread packages/junior/src/chat/respond.ts Outdated
Add generic plugin prompt hooks for system and user prompt context so runtime plugins can contribute bounded prompt text without owning prompt rendering. The public API now exposes platform-only system prompt context, request-scoped user prompt context, and bounded JSON session appends for deterministic prompt continuity.

Core collects and validates plugin contributions, renders them under Junior-owned wrappers, and commits accepted session appends with the same durable input checkpoint as the model-visible prompt. Follow-up and steering user prompts run the same userPrompt hook path, and focused integration coverage exercises generateAssistantReply with only the Pi/model boundary faked.

Co-authored-by: GPT-5 Codex <codex@openai.com>
Comment thread packages/junior/src/chat/respond.ts Outdated
Comment thread packages/junior/src/chat/plugins/agent-hooks.ts Outdated
@dcramer dcramer marked this pull request as ready for review June 19, 2026 04:09
Make userPrompt return prompt messages directly and remove the unreleased prompt session-state append path. Prompt hooks now run once for the triggering prompt of an agent run, while steering messages remain plain user input for the active run.

Co-Authored-By: GPT-5 Codex <codex@openai.com>
Comment thread packages/junior/src/chat/respond.ts
Run plugin user prompt hooks when an awaiting-resume session has not checkpointed the triggering prompt yet. Continue existing prompt checkpoints as before, but fall back to the prompt path when the stored record has no user message.

Co-Authored-By: GPT-5 Codex <codex@openai.com>
Expose prompt hook messages as text-only public API and remove prompt lifecycle flags from userPrompt context. Generate rendering identifiers inside core instead of requiring plugin-owned IDs.

Run userPrompt only while building a fresh prompt checkpoint. Allow auth-pause session records before the prompt checkpoint so pre-prompt resumes can rebuild the prompt without storing a raw synthetic user message.

Co-Authored-By: GPT-5 Codex <codex@openai.com>
Comment thread packages/junior/src/chat/respond.ts
Build userPrompt contexts from the exact public prompt surface instead of the broader plugin context, and let empty prompt message arrays behave as no contributions.

Keep pre-prompt auth resume on the fresh prompt path and align specs with the implemented prompt hook lifecycle.

Co-Authored-By: GPT-5 Codex <codex@openai.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4c73466. Configure here.

Comment thread packages/junior/src/chat/services/turn-session-record.ts
Treat empty awaiting-resume records as real turn-session resumes so pre-prompt auth pauses keep their slice metadata.

When replaying an older no-checkpoint record that already stored the raw current user prompt, trim that synthetic tail before rebuilding the fresh prompt to avoid duplicating the user turn.

Co-Authored-By: GPT-5 Codex <codex@openai.com>
@dcramer dcramer merged commit 47e2625 into main Jun 19, 2026
16 checks passed
@dcramer dcramer deleted the feat/plugin-prompt-hooks branch June 19, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant